// 引入 react 依赖
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { Text, View, Image, TouchableOpacity, ImageBackground, ScrollView, InteractionManager } from 'react-native';

// 引入第三方依赖
import _ from 'lodash';
import pureRender from 'pure-render-decorator';
import * as ActionTypes from '../../constants/constants.js'
import { Actions } from 'react-native-router-flux';

// antd 按需加载
import { Tabs, Toast } from '@ant-design/react-native';

// 引入 处理数据 所需文件
import { } from './module/module.js'

// 引入样式
import Style from './style/style.js';

// 引入公用组件
import { Status, NavBar } from '../../components/index.js'

// 引入专用组件
import { } from './components'

// 引入工具包
import { isWxUser, isUser } from '../../util/utils.js'

class LoginState extends Component {

  componentDidMount() {
    const { dispatch } = this.props
    // InteractionManager.runAfterInteractions(() => {
      // ...耗时较长的同步执行的任务...
      isWxUser((res) => {
        dispatch({
          type: ActionTypes.GET_WX_USER_INFO,
          data: res
        })
      })
      isUser((res) => {
        dispatch({
          type: ActionTypes.GET_USER_INFO,
          data: res
        })
        Actions.index()
      }, () => {
        Actions.login()
      })
    // });
  }

  render() {
    return (
      <View style={Style.container}></View >
    );
  }
}


export default connect(state => ({
  user: state.user,
}))(pureRender(LoginState))
